<!DOCTYPE html>
<html>
<head>
    <title>项目列表</title>
    #parse("include/head.html")

    <link href="$request.contextPath/res/plugin/swiper/css/swiper.min.css" rel="stylesheet">
</head>

<body>
<!--头部-->
#parse("include/nav.html")
<!--头部 end-->

<div class="container clear">
    <div class="box-m">
        <div class="ad-images">
            <div class="swiper-c2">
                <div class="swiper-wrapper">
                    #foreach ($item in ${adBanner})
                    <div class="swiper-slide">
                        <img onclick="load('$item.bannerTarget');" class="ad-images img-responsive" src="$item.bannerImg">
                    </div>
                    #end
                </div>
                <div class="swiper-p2 swiper-pagination swiper-pagination-white"></div>
            </div>
        </div>
    </div>

    <!--所有项目-->
    <div class="box-t-list all-project">
        <div id="Containerflag"></div>
    </div>

    <!--所有主播 end-->
</div>

<!--底部-->
#parse("include/footer.html")
<!--底部 end-->
#parse("include/libs.html")
<script src="$request.contextPath/res/plugin/laypage/laypage.js"></script>
<script src="$request.contextPath/res/js/project.js"></script>
<script src="$request.contextPath/res/plugin/swiper/js/swiper.jquery.min.js"></script>
<script>
    var curPage = 0;
    var isLastPage = false;
    $(window).scroll(function () {
        var scrollTop = $(this).scrollTop();
        var scrollHeight = $(document).height();
        var windowHeight = $(this).height();
        if (scrollTop + windowHeight == scrollHeight) {
            if (!isLastPage) {
                getPageData(++curPage);
            } else {
                console.log("no data any more");
            }
        }
    });

    function getPageData(curr){
        $.ajax({
            url: basePath+"/project/getProject",
            type: "POST",
            dataType: 'json',
            data: {
                "pgNum" : curr,
                "pgSize" : 12,
                "type" : 0,
                "query" : null
            },
            success: function (data) {
                var brands = data["list"];
                isLastPage = data['isLastPage'];
                var str = "";
                for(var i in brands){
                    var kys = brands[i];
                    str += "<dl onclick=\"load('"+basePath+"/project/"+kys['projectId']+"')\">" ;
                    str += "<dt> <img src=\""+kys['projectImg']+"\">";
                    str += "<dd>";
                    str +=  "<h2>" + kys['projectName']+"</h2>";
                    str += "<h3> " +kys['projectDesc'] +"</h3>";
                    var begin = new Date(kys['projectBegintime']);
                    str += "<h4>" + begin.Format("yyyy-MM-dd hh:mm:ss") + "</h4>";
                    str += "</dd>";
                    str += "<div class=\"see\"><a href=\"#\"><i class=\"ico visit\"></i>"+kys['projectViewcnt']+"</a> <a href=\"#\"><i class=\"ico favor\"></i>"+kys['projectLikecnt']+"</a></div>";
                    str += "</dt> </dl>";
                }
                $("#Containerflag").before(str);
            },
            error:function(data){
                layer.msg('获取记录失败！', {icon: 5});
            }
        });
    }

    $(document).ready(function() {
        updateNav("#projectnav");
        getPageData(++curPage);
        var swiper2 = new Swiper('.swiper-c2', {
            pagination: '.swiper-p2',
            paginationClickable: true,
            nextButton: '.swiper-button-next',
            prevButton: '.swiper-button-prev',
            autoplay: 2500,
            onTouchMove: function (swiper2, e) {
            }
        });
    });
</script>
</body>
</html>
